<template>
    <div
        class="queryServiceAccounInfo"
        v-loading="pageLoading"
        element-loading-background="rgba(255, 255, 255, 0.7)"
    >
        <cardComponent pageTitle="查询服务类-->账户资料查询">
            <template slot="cardBody">
                <div class="accountMain">
                    <div class="infoHead">
                        <div class="accountStatus">
                            账户类别：
                            <span>{{ accountType }}</span>
                        </div>
                        <div class="accountStatus">
                            账户状态:
                            <span>{{ cardStatus }}</span>
                        </div>
                        <div class="accountStatus">
                            人民币：
                            <span>美元信用额度受信比例为 7 : 1</span>
                        </div>
                    </div>

                    <div class="container">
                        <!-- 人民币信息模块 -->
                        <el-card class="box-card">
                            <div slot="headerss" class="clearfix">
                                <span>人民币</span>
                            </div>
                            <div class="infoList">
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">临时额度：</span>
                                        {{
                                        formatNumber(
                                        accountInfo.TEMPLIMIT,
                                        2
                                        )
                                        }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">逾期金额：</span>
                                        {{
                                        formatNumber(accountInfo.AGEAMT, 2)
                                        }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">逾期期数：</span>
                                        {{ accountInfo.AGEDAYS }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft"></span>
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">账户级信用额度：</span>
                                        {{
                                        formatNumber(
                                        accountInfo.CREDITLIMIT,
                                        2
                                        )
                                        }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">取现额度：</span>
                                        {{
                                        formatNumber(accountInfo.CALIMIT, 2)
                                        }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">可用额度：</span>
                                        {{
                                        formatNumber(accountInfo.AVLIMT, 2)
                                        }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">取现可用额度：</span>
                                        {{
                                        formatNumber(
                                        accountInfo.CALIMITAVB,
                                        2
                                        )
                                        }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">账面余额：</span>
                                        {{
                                        formatNumber(accountInfo.BALNCE, 2)
                                        }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">消费净额：</span>
                                        {{
                                        formatNumber(accountInfo.PURCRED, 2)
                                        }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">争议金额：</span>
                                        {{
                                        formatNumber(
                                        accountInfo.QUERYAMT,
                                        2
                                        )
                                        }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">调整金额：</span>
                                        {{
                                        formatNumber(accountInfo.ADJAMT, 2)
                                        }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">应收未收违约金：</span>
                                        {{
                                        formatNumber(accountInfo.PENCHG, 2)
                                        }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">上次额度调整日期：</span>
                                        {{ accountInfo.CREDCHGDAY }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">当期消费累计：</span>
                                        {{
                                        formatNumber(
                                        accountInfo.PURCHASES,
                                        2
                                        )
                                        }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">当期消费笔数：</span>
                                        {{ accountInfo.NBRPURCH }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">当期预借现金：</span>
                                        {{
                                        formatNumber(accountInfo.CASHADV, 2)
                                        }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">取现手续费：</span>
                                        {{
                                        formatNumber(
                                        accountInfo.CHGDFEEX,
                                        2
                                        )
                                        }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">现金贷款额度：</span>
                                        {{
                                        formatNumber(
                                        accountInfo.CALLIMIT,
                                        2
                                        )
                                        }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">现金贷款可用额度：</span>
                                        {{
                                        formatNumber(accountInfo.CALAVAL, 2)
                                        }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">可转出溢缴款：</span>
                                        {{ accountInfo.OXFRAVAL }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">应收利息：</span>
                                        {{ accountInfo.INTCHG }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">消费利率：</span>
                                        {{ accountInfo.IRPURCH }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">取现利率：</span>
                                        {{ accountInfo.IRCASH }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="24">
                                        <span class="infoColLeft">本期时点欠款：</span>
                                        {{ accountInfo.text1 }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="24">
                                        <span class="infoColLeft">最低还款额未还金额：</span>
                                        {{ accountInfo.text2 }}
                                    </el-col>
                                </el-row>
                            </div>
                        </el-card>

                        <!-- 美元信息模块 -->
                        <el-card class="box-card">
                            <div slot="headerss" class="clearfix">
                                <span>美元</span>
                            </div>
                            <div class="infoList">
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">临时额度：</span>
                                        {{ "-" }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">逾期金额：</span>
                                        {{
                                        formatNumber(accountInfo.AGEAMT2, 2)
                                        }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">逾期期数：</span>
                                        {{ accountInfo.AGEDAYS }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft"></span>
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">信用额度：</span>
                                        {{
                                        formatNumber(
                                        accountInfo.XCREDLIMIT,
                                        2
                                        )
                                        }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">取现额度：</span>
                                        {{
                                        formatNumber(
                                        accountInfo.CASHAVAL,
                                        2
                                        )
                                        }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">可用额度：</span>
                                        {{
                                        formatNumber(accountInfo.XAVLIMT, 2)
                                        }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">取现可用额度：</span>
                                        {{
                                        formatNumber(
                                        accountInfo.CASHAVALX,
                                        2
                                        )
                                        }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">账面余额：</span>
                                        {{
                                        formatNumber(accountInfo.BALNCEX, 2)
                                        }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">消费净额：</span>
                                        {{ "-" }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">争议金额：</span>
                                        {{ "-" }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">调整金额：</span>
                                        {{ "-" }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">应收未收违约金：</span>
                                        {{
                                        formatNumber(accountInfo.PENCHGX, 2)
                                        }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">上次额度调整日期：</span>
                                        {{ accountInfo.TEMPLIMIT }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">当期消费累计：</span>
                                        {{
                                        formatNumber(
                                        accountInfo.PURCHASESX,
                                        2
                                        )
                                        }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">当期消费笔数：</span>
                                        {{ accountInfo.NBRPURCHX }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">当期预借现金：</span>
                                        {{
                                        formatNumber(
                                        accountInfo.TEMPLIMIT,
                                        2
                                        )
                                        }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">取现手续费：</span>
                                        {{
                                        formatNumber(
                                        accountInfo.CHGDFEEX,
                                        2
                                        )
                                        }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">可转出溢缴款：</span>
                                        {{ accountInfo.OXFRAVALX }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">应收利息：</span>
                                        {{ accountInfo.INTCHGX }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="12">
                                        <span class="infoColLeft">消费利率：</span>
                                        {{ accountInfo.IRPURCHX }}
                                    </el-col>
                                    <el-col :span="12">
                                        <span class="infoColLeft">取现利率：</span>
                                        {{ accountInfo.IRCASHX }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="24">
                                        <span class="infoColLeft">本期时点欠款：</span>
                                        {{ accountInfo.text3 }}
                                    </el-col>
                                </el-row>
                                <el-row class="mainRow">
                                    <el-col :span="24">
                                        <span class="infoColLeft">最低还款额未还金额：</span>
                                        {{ accountInfo.text4 }}
                                    </el-col>
                                </el-row>
                            </div>
                        </el-card>
                    </div>
                </div>
                <div class="btnBox">
                    <el-button type="primary" size="small" @click="handleSendMessage">发送短信</el-button>
                </div>
            </template>
        </cardComponent>
    </div>
</template>

<script>
import { mapState } from 'vuex';
// 导入默认公用模块，是否展示字段存在Defaultxxxx文件中，其他银行是否需要展示, 在自己的逻辑页面修改对应字段的boole值，只能在本银行修改
import {
    formatNumber, ForDight, dealTempContent, getAccountTypeName, getDictSelectList,
} from '@/utils/Common';
import cardComponent from '@/components/cardComponent/cardComponent.vue';

export default {
    name: 'AccountInfo',
    // 混入的调用 ， 如同名后面的会覆盖前面的混入
    components: {
        cardComponent,
    },
    data() {
        return {
            pageLoading: false, // 页面loading
            formatNumber, // 数字格式化
            accountType: '', // 账户类别
            cardStatus: '', // 卡账户状态
            accountInfo: { // 信用卡账户信息
                // 第一币种信息 -- 人民币
                TEMPLIMIT: '', // 临时额度
                AGEAMT: '', // 逾期金额
                AGEDAYS: '', // 逾期期数
                CREDITLIMIT: '', // 信用额度
                CALIMIT: '', // 取现额度
                AVLIMT: '', // 可用额度
                CALIMITAVB: '', // 取现可用额度
                BALNCE: '', // 账面余额
                PURCRED: '', // 消费净额
                QUERYAMT: '', // 争议金额
                ADJAMT: '', // 调整金额
                PENCHG: '', // 应收未收违约金
                CREDCHGDAY: '', // 上次额度调整日期
                PURCHASES: '', // 当期消费累计
                NBRPURCH: '', // 当期消费笔数
                CASHADV: '', // 当期预借现金
                CHGDFEEX: '', // 取现手续费
                CALLIMIT: '', // 现金贷款额度
                CALAVAL: '', // 现金贷款可用额度
                OXFRAVAL: '', // 可转出溢缴款
                INTCHG: '', // 应收利息
                IRPURCH: '', // 消费利率
                IRCASH: '', // 取现利率
                CLOSECHA: '', // 本期时点欠款 - 本币账单余额方向
                CLOSEBAL: '', // 本期时点欠款 - 本币账单余额
                PYMTCLUD: '', // 本期时点欠款 - 已结算付款额
                CRADJS: '', // 本期时点欠款 - 本币贷记调整金额符号
                CREDADJ: '', // 本期时点欠款 - 本币贷记调整金额
                STMMINDUE: '', // 最低还款额未还金额 - 最低还款额
                text1: '', // 本期时点欠款
                text2: '', // 最低还款额未还金额

                // 第二币种信息 -- 美元
                AGEAMT2: '', // 逾期金额
                AGEDAYS: '', // 逾期期数
                XCREDLIMIT: '', // 信用额度
                CASHAVAL: '', // 取现额度
                XAVLIMT: '', // 可用额度
                CASHAVALX: '', // 取现可用额度
                BALNCEX: '', // 账面余额
                QUERYAMX: '', // 争议金额
                PENCHGX: '', // 应收未收违约金
                TEMPLIMIT: '', // 上次额度调整日期
                PURCHASESX: '', // 当期消费累计
                NBRPURCHX: '', // 当期消费笔数
                TEMPLIMIT: '', // 当期预借现金
                CHGDFEEX: '', // 取现手续费
                OXFRAVALX: '', // 可转出溢缴款
                INTCHGX: '', // 应收利息
                IRPURCHX: '', // 消费利率
                IRCASHX: '', // 取现利率
                CLOSECHX: '', // 本期时点欠款 - 本币账单余额方向
                CLOSEBAX: '', // 本期时点欠款 - 本币账单余额
                PYMTCLUDX: '', // 本期时点欠款 - 已结算付款额
                CRADXS: '', // 本期时点欠款 - 本币贷记调整金额符号
                CREDADX: '', // 本期时点欠款 - 本币贷记调整金额
                STMMINDUX: '', // 最低还款额未还金额 - 最低还款额
                text3: '', // 本期时点欠款
                text4: '', // 最低还款额未还金额
            },
            accountInfoData: {}, // 卡账户信息
        };
    },

    // 取缓存信息
    computed: mapState({
        cardInfo_3004: state => state.common.cardInfo_3004, // 默认卡信息
        cardList_3601: state => state.common.cardList_3601, // 卡列表信息
        3001: state => state.common.cardAccountInfo_3001, // 卡账户信息
        3002: state => state.common.customerInfo_3002, // 客户信息
        defaultParams: state => state.common.defaultParams, // 接口默认参数
        pinFlag: state => state.common.pinFlag, // 是否密码检查标志
    }),
    // 
    mounted() {
        this.init();
    },

    methods: {
        // 初始化方法
        async init() {
            // 获取初始化数据
            this.getInitData();

            // 获取卡账户状态
            this.handleGetCardStatus();

            // 查询数据库字典 获取 卡账户类别
            this.accountType = await getAccountTypeName(this.cardList_3601, this.cardInfo_3004, this);
        },

        // 获取卡账户状态
        async handleGetCardStatus() {
            const statusList = await getDictSelectList('CLOCD', this);
            statusList.forEach((item) => {
                if (item.code.trim() == this.cardInfo_3004.CARDSTAT.trim()) {
                    this.cardStatus = item.label;
                }
            });
        },

        // 获取页面初始化数据
        getInitData() {
            this.pageLoading = true;
            const appBody = {
                CARDNO: this.cardInfo_3004.CARDNO, // 卡号
                PINFLAG: this.pinFlag, // 是否检查密码标志 0-不检查
            };
            const params = JSON.parse(JSON.stringify(this.defaultParams));
            // console.log(this.defaultParams, 'this.defaultParams')
            params.body.appHead.tranCode = '3001';
            params.body.appBody = appBody;

            // 跑 3001 交易
            this.$post.common.transPort(params).then((res) => {
                this.pageLoading = false;
                if (res.status === 200) { // 请求成功
                    const result = JSON.parse(res.data.jsonRes);
                    // console.log(result, 'result -- 3001')
                    if (result.sysHead.rspCd === '000000') { // 交易成功
                        // 更新 vuex 缓存 卡账户信息
                        this.$store.commit('common/UPDATE_CARD_ACCOUNT_INFO', result.body.appBody);

                        // 账户信息 赋值
                        const data = JSON.parse(JSON.stringify(this.accountInfo));
                        for (const key in data) {
                            data[key] = result.body.appBody[key];
                        }
                        // 对战时数据做处理（金额数字展示）
                        this.accountInfo = this.handleDealData(data);
                    } else { // 交易失败
                        const errorMsg = `错误代码：${result.sysHead.rspCd}, 错误信息：${result.sysHead.rspMsg}`;
                        this.$alert(errorMsg, result.sysHead.rspDesc, '提示', {
                            customClass: 'error', type: 'error',
                        });
                    }
                } else { // 请求失败
                    this.$alert('请求失败!', '提示', {
                        customClass: 'error', type: 'error',
                    });
                }
            });
        },

        // 展示数据处理
        handleDealData(data) {
            // 本期时点欠款余额 = 带符号本币账单金额（69、70域） - 已结算付款额（81域） + 带符号本币贷记调整金额（117、118域

            // 第一币种 -- 人民币
            let { CLOSECHA } = data; // 本币账单余额方向
            let { CLOSEBAL } = data; // 本币账单余额
            const { PYMTCLUD } = data; // 已结算付款额
            const { CRADJS } = data; // 本币贷记调整金额符号
            const { CREDADJ } = data; // 本币贷记调整金额
            const { STMMINDUE } = data; // 最小还款额

            if (CLOSECHA === null || CLOSECHA === '') {
                CLOSECHA = '+';
            }
            if (CLOSEBAL === null || CLOSEBAL === '') {
                CLOSEBAL = '0.0';
            }
            if (PYMTCLUD === null || PYMTCLUD === '') {
                CLOSECHA = '+';
            }
            if (CRADJS === null || CRADJS === '') {
                CLOSEBAL = '+';
            }
            if (CREDADJ === null || CREDADJ === '') {
                CLOSECHA = '+';
            }

            let t_c1 = '';

            if (CLOSECHA === '-') {
                t_c1 = `(${Number(CLOSECHA + CLOSEBAL)})`;
            } else {
                t_c1 = Number(CLOSEBAL);
            }
            if (PYMTCLUD < 0) {
                t_c1 = `${t_c1} - (${Number(PYMTCLUD)})`;
            } else {
                t_c1 = `${t_c1} - ${Number(PYMTCLUD)}`;
            }
            if (CRADJS === '-') {
                t_c1 = `${t_c1} + (${Number(CRADJS + Number(CREDADJ))})`;
            } else {
                t_c1 = `${t_c1} + ${Number(CREDADJ)}`;
            }
            // 本期时点欠款金额
            const bq1 = Number(CLOSECHA + Number(CLOSEBAL)) - Number(PYMTCLUD) + Number(CRADJS + Number(CREDADJ));
            data.text1 = `本币账单金额 - 已结算付款额  + 本币贷记调整金额  = ${t_c1} = ${ForDight(bq1, 2)}`;
            // 最低还款额 - 已结算付款额（81域） + 带符号本币贷记调整金额（117、118域）。如果小于0，则无最低还款额未还部分。
            const wh = Number(STMMINDUE) - Number(PYMTCLUD) + Number(CRADJS + Number(CREDADJ));
            if (wh < 0) {
                const txt = '';
            } else {
                let t_c2 = '';
                t_c2 = Number(STMMINDUE);

                if (PYMTCLUD < 0) {
                    t_c2 = `${t_c2} - (${Number(PYMTCLUD)})`;
                } else {
                    t_c2 = `${t_c2} - ${Number(PYMTCLUD)}`;
                }
                if (CRADJS === '-') {
                    t_c2 = `${t_c2} + (${Number(CRADJS + Number(CREDADJ))})`;
                } else {
                    t_c2 = `${t_c2} + ${Number(CREDADJ)}`;
                }
                data.text2 = `最低还款额 - 已结算付款额  + 本币贷记调整金额  = ${t_c2} = ${ForDight(wh, 2)}`;
            }

            // 美元部分处理 ----------------------------------------
            // 第二币种 -- 美元
            let { CLOSECHX } = data; // 外币账单余额方向
            let { CLOSEBAX } = data; // 外币账单余额
            const { PYMTCLUDX } = data; // 已结算付款额
            const { CRADXS } = data; // 外币贷记调整金额符号
            const { CREDADX } = data; // 外币贷记调整金额
            const { STMMINDUX } = data; // 最小还款额

            if (CLOSECHX === null || CLOSECHX === '') {
                CLOSECHX = '+';
            }
            if (CLOSEBAX === null || CLOSEBAX === '') {
                CLOSEBAX = '0.0';
            }
            if (PYMTCLUDX === null || PYMTCLUDX === '') {
                CLOSECHX = '0.0';
            }
            if (CRADXS === null || CRADXS === '') {
                CLOSEBAX = '+';
            }
            if (CREDADX === null || CREDADX === '') {
                CLOSECHX = '0.0';
            }

            let t_c3 = '';

            if (CLOSECHX === '-') {
                t_c3 = `(${Number(CLOSECHX + Number(CLOSEBAX))})`;
            } else {
                t_c3 = Number(CLOSEBAX);
            }
            if (PYMTCLUDX < 0) {
                t_c3 = `${t_c3} - (${Number(PYMTCLUDX)})`;
            } else {
                t_c3 = `${t_c3} - ${Number(PYMTCLUDX)}`;
            }
            if (CRADXS === '-') {
                t_c3 = `${t_c3} + (${Number(CRADXS + Number(CREDADX))})`;
            } else {
                t_c3 = `${t_c3} + ${Number(CREDADX)}`;
            }
            // 本期时点欠款金额
            const bq2 = Number(CLOSECHX + Number(CLOSEBAX)) - Number(PYMTCLUDX) + Number(CRADXS + Number(CREDADX));
            data.text3 = `外币账单余额 - 已结算付款额  + 外币贷记调整金额  = ${t_c3} = ${ForDight(bq2, 2)}`;

            // 最低还款额 - 已结算付款额（81域） + 带符号本币贷记调整金额（117、118域）。如果小于0，则无最低还款额未还部分。
            const wh2 = Number(STMMINDUX) - Number(PYMTCLUDX) + Number(CRADXS + Number(CREDADX));
            if (wh2 < 0) {
                const txt = '';
            } else {
                let t_c4 = '';
                t_c4 = Number(STMMINDUX);

                if (PYMTCLUDX < 0) {
                    t_c4 = `${t_c4} - (${Number(PYMTCLUDX)})`;
                } else {
                    t_c4 = `${t_c4} - ${Number(PYMTCLUDX)}`;
                }
                if (CRADXS === '-') {
                    t_c4 = `${t_c4} + (${Number(CRADXS + Number(CREDADX))})`;
                } else {
                    t_c4 = `${t_c4} + ${Number(CREDADX)}`;
                }
                data.text4 = `最低还款额 - 已结算付款额  + 本币贷记调整金额  = ${t_c4} = ${ForDight(wh2, 2)}`;
            }
            // 处理
            for (const key in data) {
                if (key === 'IRPURCH' || key === 'IRCASH' || key === 'IRPURCHX' || key === 'IRCASHX') { // 利率字段处理 保留6位小数
                    data[key] = (Number(data[key]) / 100).toFixed(6);
                } else if (key === 'OXFRAVAL' || key === 'OXFRAVALX' || key === 'INTCHG' || key === 'INTCHGX') { // 特殊字段处理 保留一位小数
                    data[key] = data[key] === 0 ? data[key].toFixed(1) : data[key];
                }
            }
            // console.log(data, 'end -- data')
            return data;
        },

        // 点击发送短信
        handleSendMessage() {
            // 根据模板名称获取模板内容
            const params = {
                tempName: '账户资料查询模板',
            };
            this.$post.common.getTempContentByName(params).then((res) => {
                if (res.status === 200 && res.data.success) {
                    // 处理动态短信模板中的变量的值
                    const tempContent = dealTempContent(res.data.content.tempContent, this);
                    console.log(tempContent);
                    // alert('发送短信, 跳转至 发送动态短信 页面')
                    this.$router.push({
                        name: 'dynamicMessage',
                        path: '/index/dynamicMessage',
                        params: {
                            tempName: '账户资料查询模板',
                            tempContent,
                        },
                    });
                }
            });
        },
    },
};
</script>
<style lang="scss">
.queryServiceAccounInfo {
    .accountMain {
        .el-card {
            .el-card__header {
                font-size: 20px;
                font-weight: 600;
                letter-spacing: 5px;
            }
        }
    }
}
</style>
<style lang="scss">
.queryServiceAccounInfo {
    min-height: 100%;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    //头部内容
    .tab-header {
        text-align: left;
        font-size: 16px;
        .remOrDollar {
            padding-left: 16px;
            color: red;
        }
    }
    //主体展示内容
    .accountMain {
        overflow: hidden;

        .infoHead {
            padding-left: 16px;
            font-size: 16px;
            text-align: left;
            margin: 16px 0;
            overflow: hidden;
            .accountStatus {
                float: left;
                margin-right: 100px;

                & > span {
                    color: red;
                }
            }
        }
        .container {
            display: flex;
            justify-content: space-around;

            .el-card {
                width: 48%;

                .infoList {
                    font-size: 14px;

                    .mainRow {
                        text-align: left;
                        margin: 10px 0;
                        font-weight: 600;
                        .infoColLeft {
                            display: inline-block;
                            width: 150px;
                            color: #666;
                            font-weight: normal;
                            text-align: right;
                        }
                    }
                }
            }
        }
    }
    .btnBox {
        margin: 30px;
        text-align: center;
    }
    .box-card {
        width: 100% !important;
        margin: 0 15px;
        .clearfix {
            text-align: center;
        }
        .infoList {
            .el-col {
                //  text-align: center;
            }
        }
    }
}
</style>
